<template>
   <div class="app-container">
    <JFind
      :searchImg="false"
      :OriginalFilter="{ static: true }"
      :formList="formList"
      @findClicked="findClicked"
      @Launchform="Launchform3"
      @clickNumber1="clickNumber"
    />
    <div >
      <el-card  shadow="never" :body-style="{ padding: '5px 10px 5px' }" style="border: 1px solid #dcdfe6;width: 100%;">
        <h1 class="f16">新增作业</h1>
        <el-form-item label="型体" class="f14 mb5 mt5">
          <el-input v-model="addStyle.styleNo" placeholder="" clearable @change="" style="width: 120px; height: 26px"></el-input>
          <el-button type="primary" size="default" class="primaryBth ml10" @click="RdTypeBodyFileAddMethods">新增</el-button>
          <el-button type="primary" size="default" class="primaryBth ml10" @click="download('复制')">复制</el-button>
          <el-button type="primary" size="default" class="primaryBth ml10" @click="download('修改')">修改</el-button>
          <el-button type="primary" size="default" class="primaryBth ml10" @click="download('删除')">删除</el-button>
          <el-button type="primary" size="default" class="primaryBth ml10" @click="download('配码资料')">配码资料</el-button>
        </el-form-item>

        <div class="flex">
          <h1 class="f16">型体</h1>
          <span style="color: #0000ff" class="f14 ml10">填充绿色为已检核&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp双击某一行查看型体配色资料</span>
        </div>
        <Table
          :TableHeight="90"
          :tableHeader="tableHeader"
          :tableData="RdTypeBodyFileListParmsTableDate"
          selection
          :isLoading="isLoading"
          @currentRow="currentRow"
          @selectList="selectTable1List"
          @currentRow1="currentRow1"
          :functionList3="true"
        />
        <PageModule
          :PageData="{ total, pageSizeShow: true, buttonS: true, pagerCount: 4 }"
          :layout="'prev, pager'"
          @pageSizeChange="handleSizeChange"
          @pageChange="handleCurrentChange"
        />
      </el-card>
    </div>

    </div>


  <el-dialog :close-on-click-modal="false" v-model="dialogVisible12" title="型体修改" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="鞋名">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.styleName" placeholder="请输入鞋名" />
      </el-form-item>
      <el-form-item label="码制">
        <el-select v-model="RdTypeBodyFileEditMethodsParms.sizeType" placeholder="请选择样品类型" size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileCodeTableDat"
            :key="index"
            :label="item.sizeNotice"
            :value="item.sizeNotice"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="基本号(鞋号)">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.baseSize" placeholder="请输入基本号(鞋号)" />
      </el-form-item>

      <el-form-item label="客户">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.custNo" placeholder="请输入客户" />
      </el-form-item>
      <el-form-item label="客户型体">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.custStyle" placeholder="请输入客户型体" />
      </el-form-item>
      <el-form-item label="鞋款性别">

        <!-- <el-input v-model="RdTypeBodyFileEditMethodsParms.shoeSex" placeholder="请输入鞋款性别" /> -->

        <el-select v-model="RdTypeBodyFileEditMethodsParms.shoeSex" placeholder="请输入鞋款性别" size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileCodeTableDat1"
            :key="index"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="商标">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.custBrand" placeholder="请输入商标" />
      </el-form-item>
      <el-form-item label="原客户型体">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.prevCustStyle" placeholder="请输入原客户型体" />
      </el-form-item>
      <el-form-item label="大底厂商">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.soleVendor" placeholder="请输入大底厂商" />
      </el-form-item>


      <el-form-item label="楦头编号">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.lastMold" placeholder="请输入楦头编号" />
      </el-form-item>
      <el-form-item label="大底编号">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.solePart" placeholder="请输入大底编号" />
      </el-form-item>
      <el-form-item label="鞋垫编号">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.insole" placeholder="请输入鞋垫编号" />
      </el-form-item>
      <el-form-item label="中底编号">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.midsole" placeholder="请输入中底编号" />
      </el-form-item>
      <el-form-item label="版师负责人">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.mtlChecker" placeholder="请输入版师负责人" />
      </el-form-item>
      <el-form-item label="版次">
        <el-input v-model="RdTypeBodyFileEditMethodsParms.sampleDesigner" placeholder="请输入版次" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileEditMethods">确 定</el-button>
        <el-button @click="dialogVisible12 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible13" title="复制型体" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="当前型体">
        <el-input :disabled="true" v-model="RdTypeBodyFileCopyMethodsParms1" placeholder="请输入型体" />
      </el-form-item>
      <el-form-item label="型体">
        <el-input v-model="RdTypeBodyFileCopyMethodsParms.newStyleNo" placeholder="请输入型体" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileCopyMethods">确 定</el-button>
        <el-button @click="dialogVisible13 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible15" title="型体配色资料查询" width="70%" class="dialog pb0">
    <JFind
      :searchImg="false"
      :OriginalFilter="{ static: true }"
      :formList="formList3"
      @findClicked="findClicked2"
    />
        <Table
          :isLoading="isLoading1"
          :TableHeight="40"
          :outTableHeight="120"
          :tableHeader="tableHeader4"
          :tableData="tableData4"
          @download="downloa1d"
          @currentRow="currentRow2"
        />
        <el-button type="primary" size="default" @click="dialogVisible23=true">新增</el-button>
    
    <Table
          :tableHeader="tableHeader7"
          :tableData="RdTypeBodyFileOrderListTableDate"
          class="mt10"
           @download="download11"
           :TableHeight="70"
          :outTableHeight="120"
        />
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible16" title="添加数据" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input  v-model="RdTypeBodyFileColorListMethodsParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="颜色名称">
        <el-input v-model="RdTypeBodyFileColorListMethodsParms.styleColor" placeholder="请输入颜色名称" />
      </el-form-item>
      <el-form-item label="颜色代号">
        <el-input v-model="RdTypeBodyFileColorListMethodsParms.colorCode" placeholder="请输入颜色代号" />
      </el-form-item>
      <el-form-item label="季度">
        <el-input v-model="RdTypeBodyFileColorListMethodsParms.season" placeholder="请输入季度" />
      </el-form-item>
      <el-form-item label="颜色名称(英)">
        <el-input v-model="RdTypeBodyFileColorListMethodsParms.engStyleColor" placeholder="请输入颜色名称(英)" />
      </el-form-item>
      <el-form-item label="图片" style="width: 46%;">
        <el-upload
            class="avatar-uploader111"
            action="/api/file/oss/upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
            :headers="{ Authorization: tokenList }"
          >
    <img v-if="imageUrl" :src="imageUrl" class="avatar111" />
    <el-icon v-else class="avatar-uploader-icon111"><Plus /></el-icon>
  </el-upload>
      </el-form-item>



    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileColorAddMethods">确 定</el-button>
        <el-button @click="dialogVisible16 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>


  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible17" title="修改数据" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input :disabled="true"  v-model="RdTypeBodyFileColorEditParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="颜色名称">
        <el-input v-model="RdTypeBodyFileColorEditParms.styleColor" placeholder="请输入颜色名称" />
      </el-form-item>
      <el-form-item label="颜色代号">
        <el-input v-model="RdTypeBodyFileColorEditParms.colorCode" placeholder="请输入颜色代号" />
      </el-form-item>
      <el-form-item label="季度">
        <el-input v-model="RdTypeBodyFileColorEditParms.season" placeholder="请输入季度" />
      </el-form-item>
      <el-form-item label="颜色名称(英)">
        <el-input v-model="RdTypeBodyFileColorEditParms.engStyleColor" placeholder="请输入颜色名称(英)" />
      </el-form-item>

      <el-form-item label="图片" style="width: 46%;">
        <el-upload
            class="avatar-uploader111"
            action="/api/file/oss/upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
            :headers="{ Authorization: tokenList }"
          >
    <img v-if="urlList " :src="urlList " class="avatar111" />
    <el-icon v-else class="avatar-uploader-icon111"><Plus /></el-icon>
  </el-upload>

      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileColorEditMethods">确 定</el-button>
        <el-button @click="dialogVisible17 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 配码资料 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible18" title="配码资料查询" width="40%" class="dialog pb0">
    <el-button type="primary" size="default" @click="CodeDataAdded">新增</el-button>
    <Table
          style="margin-top: 10px;"
          :isLoading="isLoading10"
          :TableHeight="60"
          :outTableHeight="120"
          :tableHeader="tableHeader5"
          :tableData="RdTypeBodyFileCodeListMethodsTableDate"
          @download="downloa13d"
        />
  </el-dialog>

  <!-- 配码新增 -->
  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible19" title="配码资料新增" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">



          <el-select v-model="getNoList" multiple placeholder="取号码">
            <el-option
              v-for="item in RdTypeBodyFileCodeNumMethodsTableDate.map((item: any) => {
                return {
                  label: item.sizeNo,
                  value: `${item.seqNo}  ${item.sizeNo}`, //中间空两个
                };
              })"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileCodeAddMethods">确 定</el-button>
        <el-button @click="dialogVisible19 = false,getNoList=[]">取 消</el-button>
      </div>
    </template>
  </el-dialog>

    <!-- 配码资料修改 -->
    <el-dialog :close-on-click-modal="false"  v-model="dialogVisible2" title="配码资料修改" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">

      <el-form-item label="鞋码">
        <el-input :disabled="true" v-model="RdTypeBodyFileCodeEditParms.sizeNo" placeholder="请输入鞋码" />
      </el-form-item>
      <el-form-item label="冲刀">
        <el-input v-model="RdTypeBodyFileCodeEditParms.cutSize" placeholder="请输入冲刀" />
      </el-form-item>
      <el-form-item label="楦头">
        <el-input v-model="RdTypeBodyFileCodeEditParms.lastSize" placeholder="请输入楦头" />
      </el-form-item>
      <el-form-item label="大底">
        <el-input v-model="RdTypeBodyFileCodeEditParms.soleSize" placeholder="请输入大底" />
      </el-form-item>
      <el-form-item label="中底">
        <el-input v-model="RdTypeBodyFileCodeEditParms.insoleSize" placeholder="请输入中底" />
      </el-form-item>
      <el-form-item label="鞋垫/脚床">
        <el-input v-model="RdTypeBodyFileCodeEditParms.midsoleSize" placeholder="请输入鞋垫/脚床" />
      </el-form-item>

        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileCodeEditMethods">确 定</el-button>
        <el-button @click="dialogVisible2 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

    <!-- 生成订单号修改 -->
    <el-dialog :close-on-click-modal="false" v-model="dialogVisible23" title="生成订单号" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">

      <!-- <el-form-item label="样品类型">
        <el-input  v-model="RdTypeBodyFileOrderNumParms.sampleType" placeholder="请输入鞋码" />
      </el-form-item> -->
      <el-form-item label="样品类型">
      <el-select v-model="RdTypeBodyFileOrderNumParms.sampleType" placeholder="请选择样品类型" size="default" style="width: 240px">
          <el-option
            v-for="(item,index) in RdTypeBodyFileSampleTypeDate"
            :key="index"
            :label="item"
            :value="item"
          />
      </el-select>
    </el-form-item>
      <el-form-item label="订单数量">
        <el-input v-model="RdTypeBodyFileOrderNumParms.orderQty" placeholder="请输入订单数量" />
      </el-form-item>
      <el-form-item label="交期">
        <el-date-picker
        v-model="RdTypeBodyFileOrderNumParms.deliveryDate"
        type="date"
        placeholder="请选择日期"
        format="YYYY/MM/DD" 
        value-format="YYYY-MM-DD"  
      />
      </el-form-item>
      <el-form-item label="码数">
        <el-input v-model="RdTypeBodyFileOrderNumParms.sizeNo" placeholder="请输入码数" />
      </el-form-item>
      <el-form-item label="面衬">
        <el-input v-model="RdTypeBodyFileOrderNumParms.sockNo" placeholder="请输入面衬" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileOrderNumParms.remark" placeholder="请输入备注" />
      </el-form-item>

        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileOrderNumMethods">确 定</el-button>
        <el-button @click="dialogVisible23 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 生成订单号 -->
  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible25" title="生成订单号" width="80%" class="dialog pb0">
    
  </el-dialog>


    <!-- 大图修改 -->
    <el-dialog :close-on-click-modal="false"  v-model="dialogVisible26" title="大图细节" width="40%" class="dialog pb0">
    <el-button type="primary" size="default" @click="dialogVisible27=true">新增</el-button>
    
    <Table
          :tableHeader="tableHeader8"
          :tableData="RdTypeBodyFileDetailListTableDate"
          class="mt10"
          @download="downloa15d"
        />
  </el-dialog>

  <!-- 大图新增 -->
  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible27" title="添加数据" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="RdTypeBodyFileAddDetailParms1.orderNum" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileAddDetailParms1.remark" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="图片" style="width: 46%;">
        <el-upload
            class="avatar-uploader111"
            action="/api/file/oss/upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess1"
            :headers="{ Authorization: tokenList }"
          >
    <img v-if="imageUrl1 " :src="imageUrl1 " class="avatar111" />
    <el-icon v-else class="avatar-uploader-icon111"><Plus /></el-icon>
  </el-upload>

      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileColorEditMethods1">确 定</el-button>
        <el-button @click="dialogVisible27 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>


    <!-- 大图修改 -->
    <el-dialog :close-on-click-modal="false"  v-model="dialogVisible28" title="添加数据" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="RdTypeBodyFileDetailEditParms.orderNum" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileDetailEditParms.remark" placeholder="请输入备注" />
      </el-form-item>
      <el-form-item label="图片" style="width: 46%;">
        <el-upload
            class="avatar-uploader111"
            action="/api/file/oss/upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess1"
            :headers="{ Authorization: tokenList }"
          >
    <img v-if="RdTypeBodyFileDetailEditParms.photoPath " :src="RdTypeBodyFileDetailEditParms.photoPath " class="avatar111" />
    <el-icon v-else class="avatar-uploader-icon111"><Plus /></el-icon>
  </el-upload>

      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileDetailEditMethods">确 定</el-button>
        <el-button @click="dialogVisible28 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>


  <!-- 工艺 -->
  <el-dialog :close-on-click-modal="false"   v-model="dialogVisible11" title="添加数据" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="130px">
      <el-form-item label="护眼外量(贴前高)">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.outsideTheEyes" placeholder="请输入护眼外量(贴前高)" />
      </el-form-item>
      <el-form-item label="后跟内量高度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.heelHeight" placeholder="请输入后跟内量高度" />
      </el-form-item>
      <el-form-item label="领口外内量高度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.collar1Height" placeholder="请输入领口外内量高度" />
      </el-form-item>
      <el-form-item label="鞋带长度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.shoelaces" placeholder="请输入鞋带长度" />
      </el-form-item>
      <el-form-item label="头翘">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.headLifted" placeholder="请输入头翘" />
      </el-form-item>
      <el-form-item label="护眼内量高度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.protectTheEyes" placeholder="请输入护眼内量高度" />
      </el-form-item>
      <el-form-item label="鞋头定点">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.shoeToe" placeholder="请输入鞋头定点" />
      </el-form-item>
      <el-form-item label="鞋舌长度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.tongueLength" placeholder="请输入鞋舌长度" />
      </el-form-item>
      <el-form-item label="领口内内量高度">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.collar2Height" placeholder="请输入领口内内量高度" />
      </el-form-item>
      <el-form-item label="后套定点">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.rearFixedPoint" placeholder="请输入后套定点" />
      </el-form-item>
      <el-form-item label="后跟外量(贴底前)">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.heelOutside" placeholder="请输入后跟外量(贴底前)" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.remark" placeholder="请输入备注" />
      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileAddCraftMethods">确 定</el-button>
        <el-button @click="dialogVisible11 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible30" title="样品数据" width="80%" class="dialog pb0">
    <el-button :disabled="RdTypeBodyFileCraftListTableDate.length !== 0" type="primary" size="default" @click="dialogVisible11=true">新增</el-button>
    
    <Table
          :tableHeader="tableHeader9"
          :tableData="RdTypeBodyFileCraftListTableDate"
          class="mt10"
          @download="downloa15d1"
        />
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible31" title="工艺数据修改" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="130px">
      <el-form-item label="护眼外量(贴前高)">
        <el-input v-model="RdTypeBodyFileCraftEditParms.outsideTheEyes" placeholder="请输入护眼外量(贴前高)" />
      </el-form-item>
      <el-form-item label="后跟内量高度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.heelHeight" placeholder="请输入后跟内量高度" />
      </el-form-item>
      <el-form-item label="领口外内量高度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.collar1Height" placeholder="请输入领口外内量高度" />
      </el-form-item>
      <el-form-item label="鞋带长度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.shoelaces" placeholder="请输入鞋带长度" />
      </el-form-item>
      <el-form-item label="头翘">
        <el-input v-model="RdTypeBodyFileCraftEditParms.headLifted" placeholder="请输入头翘" />
      </el-form-item>
      <el-form-item label="护眼内量高度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.protectTheEyes" placeholder="请输入护眼内量高度" />
      </el-form-item>
      <el-form-item label="鞋头定点">
        <el-input v-model="RdTypeBodyFileCraftEditParms.shoeToe" placeholder="请输入鞋头定点" />
      </el-form-item>
      <el-form-item label="鞋舌长度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.tongueLength" placeholder="请输入鞋舌长度" />
      </el-form-item>
      <el-form-item label="领口内内量高度">
        <el-input v-model="RdTypeBodyFileCraftEditParms.collar2Height" placeholder="请输入领口内内量高度" />
      </el-form-item>
      <el-form-item label="后套定点">
        <el-input v-model="RdTypeBodyFileCraftEditParms.rearFixedPoint" placeholder="请输入后套定点" />
      </el-form-item>
      <el-form-item label="后跟外量(贴底前)">
        <el-input v-model="RdTypeBodyFileCraftEditParms.heelOutside" placeholder="请输入后跟外量(贴底前)" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileAddCraftMethodsParms.remark" placeholder="请输入备注" />
      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileCraftEditMethods">确 定</el-button>
        <el-button @click="dialogVisible31 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <el-dialog :close-on-click-modal="false"  v-model="dialogVisible32" title="订单修改" width="40%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="130px">
      <el-form-item label="订单数量">
        <el-input v-model="RdTypeBodyFileEditMethodsParms1.orderQty" placeholder="请输入订单数量" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="RdTypeBodyFileEditMethodsParms1.remark" placeholder="请输入备注" />
      </el-form-item>
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="RdTypeBodyFileSampleEditMethods">确 定</el-button>
        <el-button @click="dialogVisible32 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  export default defineComponent({
    name:'RdTypeBodyFileList'
  })
</script>
<script lang="ts" setup>
import {ref,onMounted, reactive, toRefs,computed} from 'vue'
import {RdTypeBodyFileSampleEdit,RdTypeBodyFileSampleDelete,RdTypeBodyFileSampleType,RdTypeBodyFileCraftEdit,RdTypeBodyFileCraftDelete,RdTypeBodyFileCraftList,RdTypeBodyFileAddCraft,RdTypeBodyFileOrderList,RdTypeBodyFileDetailEdit,RdTypeBodyFileDetailDelete,RdTypeBodyFileDetailList,RdTypeBodyFileAddDetail,RdTypeBodyFileOrderNum,RdTypeBodyFileCodeEdit,RdTypeBodyFileCodeDelete,RdTypeBodyFileCodeNum,RdTypeBodyFileCodeList,RdTypeBodyFileCodeAdd,RdTypeBodyFileColorEdit,RdTypeBodyFileColorDelete,RdTypeBodyFileColorAdd,RdTypeBodyFileColorList,RdTypeBodyFileCopy,RdTypeBodyFileList,RdTypeBodyFileAdd,RdTypeBodyFileCheck,RdTypeBodyFileCancelCheck,RdTypeBodyFileDelete,RdTypeBodyFileEdit,RdTypeBodyFileCode} from '@/api/ControlDepartment/MaterialManagement/RdTypeBodyFileList'
import { ElMessage, ElMessageBox } from 'element-plus';
import service from "@/utils/request"
import {cloneDeep} from 'lodash'
// 修改
const dialogVisible32 = ref(false)
const RdTypeBodyFileSampleEditMethods = async() => {
  try {
    const result = await RdTypeBodyFileSampleEdit(RdTypeBodyFileEditMethodsParms1.value)
    if(result.code === 200){
      ElMessage.success(result.msg)
      RdTypeBodyFileOrderListMethods()
      dialogVisible32.value = false 
    }else{
      ElMessage.error(result.msg)
    } 
  } catch{
    ElMessage.error('修改失败')
  }
}

const RdTypeBodyFileCodeTableDat1 = ref([{ label: '男鞋(Men)', value: '男鞋(Men)' },{ label: '女鞋(Women)', value: '女鞋(Women)' },{ label: '男女鞋(Unisex)', value: '男女鞋(Unisex)' },{label:'童鞋(Kid)',value:'童鞋(Kid)'}])

// 样品数据类型
const RdTypeBodyFileSampleTypeDate = ref([])
const RdTypeBodyFileSampleTypeMethods = async() =>{
  const result = await RdTypeBodyFileSampleType()
  RdTypeBodyFileSampleTypeDate.value = result.data
}

// 工艺数据修改

const dialogVisible31 = ref(false)
const RdTypeBodyFileCraftEditParms = ref()
const RdTypeBodyFileCraftEditMethods = async() => {
  RdTypeBodyFileCraftEditParms.value.styleNo = RdTypeBodyFileAddCraftMethodsParms.value.styleNo
  try {
    const result = await RdTypeBodyFileCraftEdit(RdTypeBodyFileCraftEditParms.value)
    if(result.code === 200){
      dialogVisible31.value = false
      RdTypeBodyFileCraftListMethods()
      ElMessage.success(result.msg) 
    } else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.error('修改失败')
  }
}


const handleCloseMateriaLKlc14 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileCraftDeleteMethods(row)
    })
    .catch(() => {})
}
// 工艺数据删除
const RdTypeBodyFileCraftDeleteMethods = async(row: any) => {
  try {
    const result = await RdTypeBodyFileCraftDelete(row.id)
    if(result.code === 200){
      RdTypeBodyFileCraftListMethods()
      ElMessage.success(result.msg)
    }else{
      ElMessage.error(result.msg)
    }
  } catch {
    ElMessage.error('删除失败') 
  }
}
const downloa15d1 = (row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc14(row)
  }
  if(item.label === '修改'){
    RdTypeBodyFileCraftEditParms.value = cloneDeep(row)
    dialogVisible31.value = true
  }
}
// 工艺数据查询
const tableHeader9 = ref([
{
    label: '尺码',
    prop: 'sizeNo'
  },
  {
    label: '护眼外量(贴底前)',
    prop: 'outsideTheEyes'
  },
  {
    label: '后跟内量高度',
    prop: 'heelHeight'
  },
  {
    label: '领口外内量高度',
    prop: 'collar1Height'
  },
  {
    label: '鞋带长度',
    prop: 'shoelaces'
  },
  {
    label: '头翘',
    prop: 'headLifted'
  },
  {
    label: '护眼内量高度',
    prop: 'protectTheEyes'
  },
  {
    label: '鞋头定点',
    prop: 'shoeToe'
  },
  {
    label: '鞋舌长度',
    prop: 'tongueLength'
  },
  {
    label: '领口内内量高度',
    prop: 'collar2Height'
  },
  {
    label: '后套定点',
    prop: 'rearFixedPoint'
  },
  {
    label: '后跟外量(贴底前)',
    prop: 'heelOutside'
  },
  {
    label: '备注',
    prop: 'remark'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '200px',
  }
])
const dialogVisible11 = ref(false)
const RdTypeBodyFileCraftListMethodsParms = ref({
  styleNo:'',
  collar1Height: "",
  collar2Height: "",
  companyId: "",
  headLifted: "",
  heelHeight: "",
  heelOutside: "",
  id: "",
  orderId: "",
  outsideTheEyes: "",
  protectTheEyes: "",
  rearFixedPoint: "",
  remark: "",
  shoeToe: "",
  shoelaces: "",
  tongueLength: ""
})
const RdTypeBodyFileCraftListTableDate = ref([])
const RdTypeBodyFileCraftListMethods = async() => {

   const result = await RdTypeBodyFileCraftList(RdTypeBodyFileCraftListMethodsParms.value)
   if (result && typeof result === 'object' && result.data) {  
    RdTypeBodyFileCraftListTableDate.value = [result.data].map((item: any) => {  
        item.functionRow = [  
            {  
                label: '修改'  
            },  
            {  
                label: '删除'  
            },  
        ];  
        return item;  
    }) as any;  
} else {  
    RdTypeBodyFileCraftListTableDate.value = [];  
}  

   console.log(result)
  
}
const dialogVisible30 = ref(false)
const RdTypeBodyFileEditMethodsParms1 = ref()
const download11 = (row: any, item: any) => {
  if(item.label === '样品数据'){
    dialogVisible30.value = true
    RdTypeBodyFileAddCraftMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.companyId = row.companyId
    RdTypeBodyFileCraftListMethods()
  }
  if(item.label === '删除'){
    RdTypeBodyFileSampleDeleteParms.value = row
    handleCloseMateriaLKlc15()
  }
  if(item.label === '修改'){
    RdTypeBodyFileEditMethodsParms1.value = cloneDeep(row)
    dialogVisible32.value = true 
  }
}
const handleCloseMateriaLKlc15 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileSampleDeleteMethdos()
    })
    .catch(() => {})
}
// 删除
const RdTypeBodyFileSampleDeleteParms = ref()
const RdTypeBodyFileSampleDeleteMethdos = async() => {
  try {
    const result = await RdTypeBodyFileSampleDelete(RdTypeBodyFileSampleDeleteParms.value) 
    if(result.code === 200){
      ElMessage.success(result.msg)
      RdTypeBodyFileOrderListMethods()
    }else{
      ElMessage.error(result.msg)
    }
  }catch{
    ElMessage.error('删除失败') 
  }
}

const tableHeader71 = ref([
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  },
  {
    label: '订单数量',
    prop: 'orderQty'
  },
  {
    type: 'dateSingle2',
    label: '交期',
    prop: 'deliveryDate'
  },
  {
    label: '码数',
    prop: 'sizeNo'
  },
  {
    label: '纸板号',
    prop: 'shoeName'
  },
  {
    label: '面衬',
    prop: 'sockNo'
  },
  {
    label: 'BOM订单数',
    prop: 'bomQty'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '200px',
  }
])

// 工艺数据添加
const RdTypeBodyFileAddCraftMethodsParms = ref({
  collar1Height: "",
  collar2Height: "",
  companyId: "",
  headLifted: "",
  heelHeight: "",
  heelOutside: "",
  id: "",
  orderId: "",
  outsideTheEyes: "",
  protectTheEyes: "",
  rearFixedPoint: "",
  remark: "",
  shoeToe: "",
  shoelaces: "",
  tongueLength: "",
  styleNo:''
})
const RdTypeBodyFileAddCraftMethods = async() => {
  try {
    const result = await RdTypeBodyFileAddCraft(RdTypeBodyFileAddCraftMethodsParms.value) 
    if(result.code === 200) {
      ElMessage.success(result.msg)
      dialogVisible11.value = false
      RdTypeBodyFileCraftListMethods() 
    }else{
      ElMessage.error(result.msg)
    }
  }catch{
    ElMessage.error('添加失败')
  }
}













// 生成订单查询
const RdTypeBodyFileOrderListMethodsParms = ref({
  color:'',
  brand: "",
  check: "",
  dataScope: "",
  deliveryEndTime: "",
  deliveryStartTime: "",
  isAsc: "",
  order: "",
  orderByColumn: "",
  orderEndTime: "",
  orderId: "",
  orderStartTime: "",
  pageNum: 0,
  pageSize: 0,
  reasonable: true,
  sampleType: "",
  seasonType: "",
  style: "",
  sysUser:"" 
})
const currentRow2 = (row:any) => {
  RdTypeBodyFileOrderListMethodsParms.value.color = row.styleColor
  RdTypeBodyFileOrderNumParms.value.color = row.styleColor
    RdTypeBodyFileOrderNumParms.value.styleNo = row.styleNo
    RdTypeBodyFileOrderNumParms.value.seasonType = row.season
    RdTypeBodyFileOrderListMethodsParms.value.style = row.styleNo
    RdTypeBodyFileOrderListMethodsParms.value.color = row.styleColor
  RdTypeBodyFileOrderListMethods()
}
const RdTypeBodyFileOrderListTableDate = ref([])
const RdTypeBodyFileOrderListMethods = async() => {
  console.log(RdTypeBodyFileOrderListMethodsParms.value)
  const result = await RdTypeBodyFileOrderList(RdTypeBodyFileOrderListMethodsParms.value)
  console.log(result)
  if(result.rows.length !== 0){
    RdTypeBodyFileOrderListTableDate.value = result.rows.map((item:any) => {
      item.functionRow = [
        {
          label: '修改'
        },
        {
          label: '删除'
        },
      ]
      return item
    })
  }else{
    RdTypeBodyFileOrderListTableDate.value = []
  }


}




// 大图细节修改
const dialogVisible28 = ref(false)
const RdTypeBodyFileDetailEditParms = ref()
const RdTypeBodyFileDetailEditMethods = async () => {
  console.log(RdTypeBodyFileDetailEditParms.value)
  const result = await RdTypeBodyFileDetailEdit(RdTypeBodyFileDetailEditParms.value)
  if(result.code === 200) {
    ElMessage.success(result.msg)
    dialogVisible28.value = false
    RdTypeBodyFileDetailListMethods()
  } else{
    ElMessage.warning(result.msg)
  }
}


// 大图细节删除
const RdTypeBodyFileDetailDeleteMethods = async (row:any) => {
  const result = await RdTypeBodyFileDetailDelete(row.id)
  if(result.code === 200) {
    ElMessage.success(result.msg)
    RdTypeBodyFileDetailListMethods() 
  } else{
    ElMessage.warning(result.msg)
  }
}
const handleCloseMateriaLKlc13 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileDetailDeleteMethods(row)
    })
    .catch(() => {})
}

const downloa15d = (row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc13(row)
  }
  if(item.label === '修改'){
    dialogVisible28.value = true
    console.log(row)
    RdTypeBodyFileDetailEditParms.value = cloneDeep(row) 
  }
}
// 大图数据查询
const RdTypeBodyFileDetailListParms = ref({
  styleNo:'',
  styleColor:''
})
const imgList1 = ref<any>([])
const RdTypeBodyFileDetailListTableDate = ref([])
const RdTypeBodyFileDetailListMethods = async() => {
  
    const result = await RdTypeBodyFileDetailList(RdTypeBodyFileDetailListParms.value) 
    console.log(result)
    RdTypeBodyFileDetailListTableDate.value = result.data.colorPhotoList.map((item:any) => {
      
      item.photoPath = Object.values(result.data.files).find((item1:any) => {  
          return item1.fileId === item.photoId; // 查找合匹配的 photoId  
      });  
        item.functionRow = [
              {
                label: '删除'
              },
              {
                label: '修改'
              },
            ]
  return item
    })

    imgList1.value = result.data.colorPhotoList.map((item:any) => {
    const {buckName,fileName} = item.photoPath
     return {buckName,fileName}
 })


  await Promise.all(
    RdTypeBodyFileDetailListTableDate.value.map(async (item:any) => {
        const result = await service.get<any, any>(`/file/oss/view/${item.photoPath.buckName}/${item.photoPath.fileName}`);
        item.photoPath = 'data:image/png;base64,'+result.data
        return 'data:image/png;base64,'+result.data
      })
    );

    imgList1.value = await Promise.all(  
          imgList1.value.map(async (item:any) => {  
            const result = await service.get<any, any>(`/file/oss/view/${item.buckName}/${item.fileName}`);  
            return 'data:image/png;base64,'+result.data
          })  
        );  


}


const dialogVisible27 = ref(false)
const imageUrl1 = ref('')
const handleAvatarSuccess1 = async (response: any,) => {
if(response.code === 200){
  const url =  await service.get<any, any>(`/file/oss/view/${response.data.bucketName}/${response.data.fileName}`);
  RdTypeBodyFileAddDetailParms1.value.photoId = response.data.fileId
  if(RdTypeBodyFileDetailEditParms.value){
    
    RdTypeBodyFileDetailEditParms.value.photoId = response.data.fileId
    RdTypeBodyFileDetailEditParms.value.photoPath = 'data:image/png;base64,'+url.data
  }
  
  imageUrl1.value = 'data:image/png;base64,'+url.data
  RdTypeBodyFileDetailEditParms.value.photoPath = 'data:image/png;base64,'+url.data

  ElMessage.success('上传图片成功')
}else{
  ElMessage.warning('图片上传失败!请重试')
}


  
}

// 大图添加
const RdTypeBodyFileAddDetailParms1 = ref<any>({
  companyId: "",
  id: "",
  orderNum: 0,
  photoId: 0,
  remark: "",
  styleColor: "",
  styleNo: ""
})
const RdTypeBodyFileColorEditMethods1 = () => {
  if(RdTypeBodyFileAddDetailParms1.value.photoId === 0 || RdTypeBodyFileAddDetailParms1.value.orderNum === 0) {
    ElMessage.warning('数据不完善不可提交!!!')
    return 
  }
  RdTypeBodyFileAddDetailMethods()
}
const dialogVisible26 = ref(false)
const tableHeader8 = ref([
  {
    label: '序号',
    prop: 'orderNum'
  },
  {
    width: 140,
    type: 'img',
    label: '图片',
    fixed: true,
    prop: 'photoPath',
    srcList: imgList1
  },
  {
    label: '备注',
    prop: 'remark'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '200px',
  }
])
const RdTypeBodyFileAddDetailMethods = async() => {
  try {
    const result = await RdTypeBodyFileAddDetail(RdTypeBodyFileAddDetailParms1.value)
    if(result.code === 200) {
      RdTypeBodyFileAddDetailParms1.value.remark = ''
      RdTypeBodyFileAddDetailParms1.value.orderNum = 0
      imageUrl1.value = ''
      dialogVisible27.value = false
      ElMessage.success(result.msg)
      RdTypeBodyFileDetailListMethods()
    } else{
      ElMessage.error(result.msg)
    }
  }catch{
    ElMessage.error('添加失败') 
  }
}



















// 订单号查询
const tableData5 = ref([])

const tableHeader7 = ref([
  {
    label: '订单号',
    prop: 'orderId'
  },
  {
    label: '样品类型',
    prop: 'sampleType'
  },
  {
    label: '订单数量',
    prop: 'orderQty'
  },
  {
    type: 'dateSingle2',
    label: '交期',
    prop: 'deliveryDate'
  },
  {
    label: '码数',
    prop: 'sizeNo'
  },
  {
    label: '面衬',
    prop: 'sockNo'
  },
  {
    label: '备注',
    prop: 'remark'
  },
    {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '300px',
  }
])

// 生成订单号
const dialogVisible23 = ref(false)
const RdTypeBodyFileOrderNumParms = ref<any>({
  bomQty: "",
  brand: "",
  closeDate: "",
  closeFlag: "",
  closeUser: "",
  color: "",
  companyId: "",
  custStyle: "",
  deliveryDate: "",
  lastNo: "",
  moldNo: "",
  orderDate: "",
  orderId: "",
  orderQty: 0,
  remark: "",
  sampleType: "",
  seasonType: "",
  shoeName: "",
  sizeNo: "",
  sockNo: "",
  style: "",
  sysDate: "",
  sysUser: "",
  uuid: ""
})
const dialogVisible25 = ref(false)
const RdTypeBodyFileOrderNumMethods = async() => {
  if(RdTypeBodyFileOrderNumParms.value.sampleType === '' || RdTypeBodyFileOrderNumParms.value.orderQty === '' || RdTypeBodyFileOrderNumParms.value.deliveryDate === '') {
    ElMessage.warning('数据不完善不可提交!!!')
    return 
  }
  try {
    const result = await RdTypeBodyFileOrderNum(RdTypeBodyFileOrderNumParms.value) 
    if(result.code === 200) {
      RdTypeBodyFileOrderNumParms.value.sampleType = ''
      RdTypeBodyFileOrderNumParms.value.orderQty = ''
      RdTypeBodyFileOrderNumParms.value.deliveryDate = ''
      RdTypeBodyFileOrderNumParms.value.sizeNo = ''
      RdTypeBodyFileOrderNumParms.value.shoeName = ''
      RdTypeBodyFileOrderNumParms.value.sockNo = ''
      RdTypeBodyFileOrderNumParms.value.bomQty =  ''
      dialogVisible23.value = false
      ElMessage.success(result.msg)
      RdTypeBodyFileOrderListMethods()
    }else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.error(`生成订单号失败`)
  }
}

// 配码资料修改
const dialogVisible2 = ref(false)

const RdTypeBodyFileCodeEditParms = ref()
const RdTypeBodyFileCodeEditMethods = async() => {
  try {
    const result = await RdTypeBodyFileCodeEdit(RdTypeBodyFileCodeEditParms.value)
    if(result.code === 200) {
      dialogVisible2.value = false
      ElMessage.success(result.msg)
      RdTypeBodyFileCodeListMethods() 
    } else{
      ElMessage.error(result.msg)
    }
  } catch {
    ElMessage.warning('修改失败请重试') 
  }
}



// 配码资料删除
const RdTypeBodyFileCodeDeleteMethods = async(id:any) => {
  try {
    const result = await RdTypeBodyFileCodeDelete(id.id)
    if(result.code === 200) {
      ElMessage.success(result.msg)
      RdTypeBodyFileCodeListMethods() 
    } else {
      ElMessage.error(result.msg) 
    }
  } catch {
    ElMessage.warning('删除失败请重试')
  }
}

const handleCloseMateriaLKlc12 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileCodeDeleteMethods(row)
    })
    .catch(() => {})
}

const downloa13d = (row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc12(row)
  }
  if(item.label === '修改'){
    dialogVisible2.value = true
    RdTypeBodyFileCodeEditParms.value = cloneDeep(row) 
  }
}


// 配码新增
const dialogVisible19 = ref(false)
const CodeDataAdded = () => {
  dialogVisible19.value = true 
}

const getNoList = ref([]) as any

// 配码资料新增
const RdTypeBodyFileCodeAddMethods = async() => {
  if(getNoList.value.length === 0) {
    ElMessage.warning('还未选择任何号码,不可新增!!!')
    return
  }
  getNoList.value = getNoList.value.map((item:any) => {
    return {
        seqNo: item.split('  ')[0],
        sizeNo: item.split('  ')[1],
        cutSize: item.split('  ')[1],
        lastSize: item.split('  ')[1],
        soleSize: item.split('  ')[1],
        insoleSize: item.split('  ')[1],
        midsoleSize: item.split('  ')[1],
        styleNo: RdTypeBodyFileCodeListParms.value
      }
  })
  try {
    const result = await RdTypeBodyFileCodeAdd(getNoList.value)
    if(result.code === 200) {
      dialogVisible19.value = false
      ElMessage.success(result.msg)
      getNoList.value = []
      RdTypeBodyFileCodeListMethods()
    }else{
      getNoList.value = []
      ElMessage.error(result.msg)
    } 
  } catch (error) {
    ElMessage.warning('新增失败请重试') 
  }
}


// 配码号查询
const RdTypeBodyFileCodeNumParms = ref({
  styleNo: '',
  sizeCode:''
})
const RdTypeBodyFileCodeNumMethodsTableDate = ref<any>([])
const RdTypeBodyFileCodeNumMethods = async() => {
  try {
    const result = await RdTypeBodyFileCodeNum(RdTypeBodyFileCodeNumParms.value)
    RdTypeBodyFileCodeNumMethodsTableDate.value = result.data
    console.log(RdTypeBodyFileCodeNumMethodsTableDate.value)
  } catch{
    ElMessage.warning('查询失败请重试')
  }
}


// 配码资料查询
const RdTypeBodyFileCodeListParms = ref('')
const RdTypeBodyFileCodeListMethodsTableDate = ref([])
const isLoading10 = ref(false)
const RdTypeBodyFileCodeListMethods = async () => {
  isLoading10.value = true
  try {
    const result = await RdTypeBodyFileCodeList(RdTypeBodyFileCodeListParms.value) 
    console.log(result)
    RdTypeBodyFileCodeListMethodsTableDate.value = result.data.map((item:any) => {
      item.functionRow = [
        {
          label: '修改'
        },
        {
          label: '删除'
        },

      ]
      return item
    })
  }catch{
    ElMessage.warning('查询失败请重试')
  }
  isLoading10.value = false
}

const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const dialogVisible18 = ref(false)


// 配色资料修改
const dialogVisible17 = ref(false)
const RdTypeBodyFileColorEditParms = ref()
const RdTypeBodyFileColorEditMethods = async() => {
  try {
    const result = await RdTypeBodyFileColorEdit(RdTypeBodyFileColorEditParms.value) 
    if(result.code === 200) {
      ElMessage.success(result.msg)
      dialogVisible17.value = false
      RdTypeBodyFileColorListMethods() 
    }else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.warning('修改失败请重试')
  }
}

// 配色资料删除
const RdTypeBodyFileColorDeleteMethods = async(row:any) => {
  try {
    const result = await RdTypeBodyFileColorDelete(row.id)
    if(result.code === 200) {
      ElMessage.success(result.msg)
      RdTypeBodyFileColorListMethods()
    }else{
      ElMessage.error(result.msg)
    } 
  } catch{
    ElMessage.warning('删除失败请重试')
  }
}

const handleCloseMateriaLKlc1 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileColorDeleteMethods(row)
    })
    .catch(() => {})
}
const urlList = ref('')
const downloa1d = async(row: any, item: any) => {
  if(item.label === '删除'){
    handleCloseMateriaLKlc1(row)
  }
  if(item.label === '修改'){
    dialogVisible17.value = true
    RdTypeBodyFileColorEditParms.value = cloneDeep(row)
    urlList.value  = row.photoPath
  }
  if(item.label === '生成订单号'){
    RdTypeBodyFileOrderNumParms.value.color = row.styleColor
    RdTypeBodyFileOrderNumParms.value.styleNo = row.styleNo
    RdTypeBodyFileOrderNumParms.value.seasonType = row.season
    RdTypeBodyFileOrderListMethodsParms.value.style = row.styleNo
    RdTypeBodyFileOrderListMethodsParms.value.color = row.styleColor
    dialogVisible25.value = true
  }
  if(item.label === '大图细节'){
    dialogVisible26.value = true
    
    RdTypeBodyFileAddDetailParms1.value.styleNo = row.styleNo
    RdTypeBodyFileAddDetailParms1.value.styleColor = row.styleColor
    RdTypeBodyFileDetailListParms.value.styleColor = row.styleColor
    RdTypeBodyFileDetailListParms.value.styleNo = row.styleNo
    RdTypeBodyFileDetailListMethods()
  }
}

// 配色资料新增
const RdTypeBodyFileColorListMethodsParms  = ref({
  colorCode: "",
  engStyleColor: "",
  id: "",
  photoId: 0,
  remark: "",
  season: "",
  seqNo: "",
  styleColor: "",
  styleNo: ""
})
const RdTypeBodyFileColorAddMethods = async() => {
  if(!RdTypeBodyFileColorListMethodsParms.value.seqNo) {
    ElMessage.warning('请输入序号')
    return
  }
  try {
    const result = await RdTypeBodyFileColorAdd(RdTypeBodyFileColorListMethodsParms.value)
    if(result.code === 200) {
      ElMessage.success('新增成功')
      dialogVisible16.value = false
      RdTypeBodyFileColorListMethodsParms.value.colorCode = ''
      RdTypeBodyFileColorListMethodsParms.value.engStyleColor = ''
      RdTypeBodyFileColorListMethodsParms.value.photoId = 0
      RdTypeBodyFileColorListMethodsParms.value.remark = ''
      RdTypeBodyFileColorListMethods() 
    }
  } catch (error) {
    ElMessage.warning('新增失败请重试')
  }
}







const currentTableRow = ref({}) as any
const dialogVisible16 = ref(false)
const findClicked2 = (row:any) => {
  if(row === '添加数据') {
    dialogVisible16.value = true
    imageUrl.value = ''
  }
}

const formList3 = ref([
  {
    type: 'button',
    checkboxLabel: '添加数据',
    bgColor: '#1890FF'
  },
])

const imageUrl = ref('')
// 型体配色资料查询
const isLoading1 = ref(false)
const tableData4 = ref([])
const imgList = ref<any>([])
const RdTypeBodyFileColorListParms = ref('')
const RdTypeBodyFileColorListMethods = async() => {
  RdTypeBodyFileSampleTypeMethods()
  // isLoading1.value = true
 const result = await RdTypeBodyFileColorList(RdTypeBodyFileColorListParms.value)

// 提取 URL并添加 token  
tableData4.value = result.data.colorList.map((item:any) => {
  
  item.photoPath = Object.values(result.data.files).find((item1:any) => {  
    return item1.fileId === item.photoId; // 查找合匹配的 photoId  
});  
  item.functionRow = [
        {
          label: '删除'
        },
        {
          label: '修改'
        },
        {
          label:'大图细节'
        },
        // {
        //   label:'生成订单号'
        // }
        

      ]
  return item
 })
 imgList.value = result.data.colorList.map((item:any) => {
    const {buckName,fileName} = item.photoPath
     return {buckName,fileName}
 })
  await Promise.all(
      tableData4.value.map(async (item:any) => {
        const result = await service.get<any, any>(`/file/oss/view/${item.photoPath.buckName}/${item.photoPath.fileName}`);
        item.photoPath = 'data:image/png;base64,'+result.data
        return 'data:image/png;base64,'+result.data
      })
    );
 imgList.value = await Promise.all(  
      imgList.value.map(async (item:any) => {  
        const result = await service.get<any, any>(`/file/oss/view/${item.buckName}/${item.fileName}`);  
        return 'data:image/png;base64,'+result.data
      })  
    );  
      if(result.data.colorList.length > 0){
        RdTypeBodyFileOrderListMethodsParms.value.color = result.data.colorList[0].styleColor
        RdTypeBodyFileOrderNumParms.value.color = result.data.colorList[0].styleColor
    RdTypeBodyFileOrderNumParms.value.styleNo = result.data.colorList[0].styleNo
    RdTypeBodyFileOrderNumParms.value.seasonType = result.data.colorList[0].season

    console.log(RdTypeBodyFileOrderNumParms.value)

        RdTypeBodyFileOrderListMethods()
      }else{
        RdTypeBodyFileOrderListMethods()
      }



 isLoading1.value = false
}



const dialogVisible15 = ref(false)


const currentRow1 = (row:any) => {

    dialogVisible15.value = true
    RdTypeBodyFileColorListParms.value = row.styleNo
    RdTypeBodyFileColorListMethodsParms.value.styleNo = row.styleNo
    RdTypeBodyFileOrderNumParms.value.style = row.styleNo
    RdTypeBodyFileOrderNumParms.value.brand = row.custNo
    RdTypeBodyFileOrderListMethodsParms.value.style = row.styleNo
    RdTypeBodyFileColorListMethods()
  

}

const tableHeader4 = ref([
  {
    width: 50,
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '颜色名称',
    prop: 'styleColor'
  },
  {
    width: 80,
    label: '颜色代号',
    prop: 'colorCode'
  },
  {
    label: '季度',
    prop: 'season'
  },

  {
    label: '颜色名称(英)',
    prop: 'engStyleColor'
  },
  // {
  //   label: '颜色简称',
  //   prop: 'shortStyleColor'
  // },
  {
    width: 140,
    type: 'img',
    label: '图片',
    fixed: true,
    prop: 'photoPath',
    srcList: imgList
  },
  {
    type: 'download',
    label: '下载图片'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '400px',
  }
])

const tableHeader5 = ref([
  {
    label: '鞋码',
    prop: 'sizeNo'
  },
  {
    label: '冲刀',
    prop: 'cutSize'
  },
  {
    label: '楦头',
    prop: 'lastSize'
  },
  {
    label: '大底',
    prop: 'soleSize'
  },
  {
    label: '中底',
    prop: 'insoleSize'
  },
  {
    label: '鞋垫/脚床',
    prop: 'midsoleSize'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: '200px',
  }
])


const drawer2 = ref(false)

// 大图添加
const RdTypeBodyFileAddDetailParms = ref({
  companyId: "",
  createTime: "",
  id: "",
  orderNum: 0,
  params: {},
  photoId: 0,
  remark: "",
  styleColor: "",
  styleNo: "",
  updateTime: ""
})
const ImagePath = ref<any>('')
const handleAvatarSuccess = async (response: any,) => {
if(response.code === 200){
  RdTypeBodyFileColorListMethodsParms.value.photoId = response.data.fileId
  console.log(RdTypeBodyFileColorEditParms.value)
  if(RdTypeBodyFileColorEditParms.value){
    RdTypeBodyFileColorEditParms.value.photoId = response.data.fileId
  }
  

  const url =  await service.get<any, any>(`/file/oss/view/${response.data.bucketName}/${response.data.fileName}`);
  imageUrl.value = 'data:image/png;base64,'+url.data
  urlList.value = 'data:image/png;base64,'+url.data


  ElMessage.success('上传图片成功')
}else{
  ElMessage.warning('图片上传失败!请重试')
}


  
}

const RdTypeBodyFileCodeTableDat = ref<any>([])
const RdTypeBodyFileCodeMethods = async() =>{
  const result = await RdTypeBodyFileCode()
  RdTypeBodyFileCodeTableDat.value = result.data
}

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    postCode: undefined,
    postName: undefined,
    status: undefined
  },
  rules: {
    postName: [{ required: true, message: '材料属性不能为空', trigger: 'blur' }],
    postSort: [{ required: true, message: '名称组成顺序不可为空', trigger: 'blur' }]
  }
})

const { queryParams, form, rules } = toRefs(data)
// 修改
const RdTypeBodyFileEditMethodsParms = ref()
const RdTypeBodyFileEditMethods = async() => {
  try {
    const result = await RdTypeBodyFileEdit(RdTypeBodyFileEditMethodsParms.value)
    if(result.code === 200) {
      dialogVisible12.value = false
      ElMessage.success(result.msg)
      RdTypeBodyFileListMethods() 
    } else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.error('修改失败')
  }
}


const dialogVisible12 = ref(false)
const downloadParms = ref()
const download = (row: any, item?: any) => {
  if(downloadParms.value === undefined){
    return ElMessage.warning('请先选择数据')
  }
  if(row === '配码资料'){
    dialogVisible18.value = true
    RdTypeBodyFileCodeListParms.value = downloadParms.value.styleNo
    RdTypeBodyFileCodeNumParms.value.sizeCode = downloadParms.value.sizeType
    RdTypeBodyFileCodeNumParms.value.styleNo = downloadParms.value.styleNo
    RdTypeBodyFileCodeListMethods()
    RdTypeBodyFileCodeNumMethods()
  }
  if(row === '删除'){
    handleCloseMateriaLKlc5(downloadParms.value)
  }
  if(row === '修改'){
    dialogVisible12.value = true
    RdTypeBodyFileEditMethodsParms.value = cloneDeep(downloadParms.value)
  }
  if(row === '复制'){
    RdTypeBodyFileCopyMethodsParms.value.id = downloadParms.value.id
    RdTypeBodyFileCopyMethodsParms1.value = downloadParms.value.styleNo
    dialogVisible13.value = true 
  }

}
const RdTypeBodyFileCopyMethodsParms = ref({
  newStyleNo:'',
  id:''
})

const RdTypeBodyFileCopyMethodsParms1 = ref('')

const dialogVisible13 = ref(false)
const RdTypeBodyFileCopyMethods = async() => {
  if(RdTypeBodyFileCopyMethodsParms.value.newStyleNo === ''){
    ElMessage.warning('请输入新型体')
    return
  }
  try {
    const result = await RdTypeBodyFileCopy(RdTypeBodyFileCopyMethodsParms.value)
    if(result.code === 200) {
      RdTypeBodyFileCopyMethodsParms.value.newStyleNo = ''
      dialogVisible13.value = false
      ElMessage.success(result.msg)
      RdTypeBodyFileListMethods() 
    } else{
      ElMessage.error(result.msg)
    }
  }catch{
    ElMessage.error('复制失败') 
  }
}

// 整单删除
const RdTypeBodyFileDeleteMethods = async(row:any) => {
  try {
    const result = await RdTypeBodyFileDelete(row.id)
    if(result.code === 200) {
      ElMessage.success(result.msg)
      RdTypeBodyFileListMethods() 
    } else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.error('删除失败')
  }
}

const handleCloseMateriaLKlc5 = (row:any) => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      RdTypeBodyFileDeleteMethods(row)
    })
    .catch(() => {})
}
// 取消检核
const RdTypeBodyFileCancelCheckParms = ref([])
const RdTypeBodyFileCancelCheckMethods = async() => {
  try {
    const result = await RdTypeBodyFileCancelCheck(RdTypeBodyFileCancelCheckParms.value) 
    if(result.code === 200) {
      ElMessage.success(result.msg)
      RdTypeBodyFileCancelCheckParms.value = []
      RdTypeBodyFileListMethods() 
    }else{
      ElMessage.error(result.msg) 
    }
  } catch (error) {
    ElMessage.error('取消检核失败')
  }
}

// 检核
const RdTypeBodyFileCheckParms = ref([])
const RdTypeBodyFileCheckMethods = async() => {
  try {
    const result = await RdTypeBodyFileCheck(RdTypeBodyFileCheckParms.value)
    if(result.code === 200) {
      ElMessage.success(result.msg)
      RdTypeBodyFileCheckParms.value = []
      RdTypeBodyFileListMethods() 
    }else{
      ElMessage.error(result.msg) 
    }
  } catch (error) {
    ElMessage.error('检核失败')
  }
}
const tableHeader = ref([
  {
    label: '型体',
    prop: 'styleNo',
    backgroundColor: true
  },
  {
    label: '鞋名',
    prop: 'styleName',
    backgroundColor: true,
    width: '170px',
  },
  {
    label: '码制',
    prop: 'sizeType',
    backgroundColor: true,
  },
  {
    label: '基本号(鞋码)',
    prop: 'baseSize',
    backgroundColor: true,
    width: '130px',
  },
  {
    label: '客户',
    prop: 'custNo',
    backgroundColor: true,
    width: '170px',
  },
  {
    label: '客户型体',
    prop: 'custStyle',
    backgroundColor: true
  },
  {
    label: '鞋款性别',
    prop: 'shoeSex',
    backgroundColor: true
  },
  {
    label: '商标',
    prop: 'custBrand',
    backgroundColor: true
  },
  {
    label: '原客户型体',
    prop: 'prevCustStyle',
    backgroundColor: true
  },
  {
    label: '大底厂商',
    prop: 'soleVendor',
    backgroundColor: true
  },
  {
    label: '楦头编号',
    prop: 'lastMold',
    backgroundColor: true
  },
  {
    label: '大底编号',
    prop: 'solePart',
    backgroundColor: true
  },
  {
    label: '鞋垫编号',
    prop: 'insole',
    backgroundColor: true
  },
  {
    label: '中底编号',
    prop: 'midsole',
    backgroundColor: true
  },
  {
    label: '版师负责人',
    prop: 'mtlChecker',
    backgroundColor: true
  },
  {
    label: '版次',
    prop: 'sampleDesigner',
    backgroundColor: true
  },
  // {
  //   label: '操作',
  //   prop: 'outSum',
  //   type: 'functionRow',
  //   width: '300px',
  //   fixed: 'left'
  // }

])

const currentRow = (row:any) => {
  downloadParms.value = row
    RdTypeBodyFileAddCraftMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.styleNo = row.styleNo
    RdTypeBodyFileCraftListMethodsParms.value.companyId = row.companyId
    RdTypeBodyFileAddCraftMethodsParms.value.styleNo = row.styleNo
}

const selectTable1List = (val:any) => {
  RdTypeBodyFileCheckParms.value = val.map((item:any) => {
    return item.id
  })

  RdTypeBodyFileCancelCheckParms.value = val.map((item:any) => {
    return item.id
  })
}

const isLoading = ref(false)
// 型体新增
const addStyle = ref({
  baseSize: "",
  custBrand: "",
  custNo: "",
  custStyle: "",
  cutTool: "",
  id: "",
  insole: "",
  lastMold: "",
  midsole: "",
  mtlChecker: "",
  prevCustStyle: "",
  remark: "",
  sampleDesigner: "",
  shoeSex: "",
  shoeType: "",
  sizeType: "",
  soleMtl: "",
  solePart: "",
  soleVendor: "",
  styleName: "",
  styleNo: ""
})

const RdTypeBodyFileAddMethods = async() => {
  if(addStyle.value.styleNo === '') {
    ElMessage.warning('请输入型体')
    return
  }
  try {
    const result = await RdTypeBodyFileAdd(addStyle.value)
    if(result.code === 200) {
      ElMessage.success(result.msg)
      addStyle.value.styleNo = ''
      RdTypeBodyFileListMethods()
    }else{
      ElMessage.error(result.msg)
    }
    console.log(result);
  } catch (error) {
    ElMessage.error('新增失败')
  }
}

// 表一模块
const formList = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入鞋名',
    inputValue: ''
  },
  // {
  //   type: 'input',
  //   inputPlaceholder: '请输入冲刀',
  //   inputValue: ''
  // },
  {
    type: 'radio1',
    checkboxLabel: '我的型体',
    label: '0'
  },
  {
    type: 'radio1',
    checkboxLabel: '所有型体',
    label: '1'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '打勾检核',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '取消检核',
    bgColor: '#1890FF'
  },
  {
    type: 'button',
    checkboxLabel: '样品数据',
    bgColor: '#1890FF'
  },
  // {
  //   type: 'button',
  //   checkboxLabel: '转型体配色BOM建档'
  // },
  // {
  //   type: 'button',
  //   checkboxLabel: '转指令资料输入'
  // },

  // {
  //   type: 'button',
  //   checkboxLabel: '数据资料',
  //   bgColor: '#67C23A'
  // }
])

const findClicked = (row:any) => {
  if(row === '样品数据'){
    dialogVisible30.value = true
    RdTypeBodyFileAddCraftMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.orderId = row.orderId
    RdTypeBodyFileCraftListMethodsParms.value.companyId = row.companyId
    RdTypeBodyFileCraftListMethods()
  }
  if(row === '大图细节补充'){
    drawer2.value = true
  }
  if(row === '置空') {
    formList.value[0].inputValue = ''
    formList.value[1].inputValue = ''
  }
  if(row === '打勾检核'){
    if(RdTypeBodyFileCheckParms.value.length === 0) {
      ElMessage.warning('请选择要检核的型体')
      return 
    }else{
      RdTypeBodyFileCheckMethods()
    }
  }
  if(row === '取消检核'){
    if(RdTypeBodyFileCancelCheckParms.value.length === 0) {
      ElMessage.warning('请选择要取消检核的型体')
      return
    }else{
      RdTypeBodyFileCancelCheckMethods()
    }
  }
  console.log(row);
}

// 型体查询
const RdTypeBodyFileListParms = ref<any>({
  createBy: "",
  createTime: "",
  num: 0,
  params: {},
  remark: "",
  styleName: "",
  styleNo: "",
  updateTime: "",
  pageSize:40,
  currentPage:1
})

const Launchform3 = (row: any) => {
  RdTypeBodyFileListParms.value.styleNo = row[0].inputValue
  RdTypeBodyFileListParms.value.styleName = row[1].inputValue

  RdTypeBodyFileListMethods()
}

const clickNumber = (row: string) => {
  console.log(row)
  switch (row) {
    case '0': {
      RdTypeBodyFileListParms.value.num = 0
      break
    }
    case '1': {
      RdTypeBodyFileListParms.value.num = 1
      break
    }
  }
  RdTypeBodyFileListMethods()
}


const total = ref(0)
const handleSizeChange = (val: number) => {
  RdTypeBodyFileListParms.value.pageSize = val
  RdTypeBodyFileListMethods()
}
const handleCurrentChange = (val: number) => {
  RdTypeBodyFileListParms.value.currentPage = val
  RdTypeBodyFileListMethods()
}

const RdTypeBodyFileListParmsTableDate = ref([])

const RdTypeBodyFileListMethods = async() => {
  isLoading.value = true
  try {
    const result = await RdTypeBodyFileList(RdTypeBodyFileListParms.value)
    RdTypeBodyFileListParmsTableDate.value = result.rows.map((item:any) => {
      if(item.cfmFlag === 'Y'){
        item.backgroundColor = '#00ff00'
      }else{
        item.functionRow = [
      {
          label: '复制'
        },
        {
          label: '修改'
        },
        {
          label: '删除'
        },
        {
          label: '配码资料'
        },

      ]
      }

      return item
    })
    total.value = result.total
    console.log(RdTypeBodyFileListParmsTableDate.value);
  } catch (error) {
    ElMessage.error('型体查询出错')
  }
  isLoading.value = false
}

const tokenList = ref<any>('')

onMounted(() => {
  RdTypeBodyFileListMethods()

  RdTypeBodyFileCodeMethods()

  const token = sessionStorage.getItem('Authorization')
  tokenList.value = token
})
</script>

<style scoped>

.avatar-uploader111 .avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>

<style>
.avatar-uploader111 .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader111 .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon111 {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
}

.avatar111{
  width: 178px;
  height: 178px;
}
</style>
